package com.booking.action;

import java.io.IOException;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.booking.bean.PageBean;
import com.booking.bean.Seller;
import com.booking.service.SellerQueryService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

@Controller
public class MrgAction extends ActionSupport  implements ModelDriven<Seller>{
	
	//模型驱动使用的对象
	private Seller seller = new Seller();
	@Override
	public Seller getModel() {
		return seller;
	}
	
	@Autowired
	private SellerQueryService sellerQueryService;
	
	

	public String  querySeller() throws IOException{

		List<Seller> list = sellerQueryService.querySeller();
	
		  JSONArray object = JSONArray.fromObject(list);
          HttpServletResponse response = ServletActionContext.getResponse();
          response.setContentType("html/text;charset=UTF-8");
          response.getWriter().write(object.toString());  
          return null;  
	}
	

}
